/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package proyectoprogracuestionario;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

/**
 *
 * @author Diego
 */
public class VentFormulario extends JFrame implements ActionListener{
    
 private JPanel pnlPreguntaCom,pnl1,pnlPreguntatexto;   
 private JLabel lblPregunta;
 private PreCombobox PreguntaCom;
 private Texto PreguntaText;
 private TextoArea PreguntaTextA;
 private JLabel lblTituP,lblTextA;
 private JComboBox aux;
 ArrayList<PreCombobox> preguntasCombo= new ArrayList();
 private ArrayList<String> auxsolu= new ArrayList();
 
 private ArrayList<JPanel>panelP=new ArrayList();
 
// public void enviarPre(String pregunta,String TextAyu,JPanel pnlP){
//  lblTituP.setText(pregunta); 
//  lblTextA.setText(TextAyu);
//     
// }
 
 public VentFormulario(String Tpregunta,String TxAyuda,String Tipopregunta){
     this.setSize(300,300);
     this.add(pnl1= new JPanel());
     pnl1.setLayout(new BoxLayout(pnl1, BoxLayout.Y_AXIS));
     
     if(Tipopregunta.equalsIgnoreCase("ComboBox")){
            System.out.println("entro");
            //pnl1.add(pnlPreguntaCom= new JPanel());
            pnlPreguntaCom= new JPanel();
            pnlPreguntaCom.setLayout(new BoxLayout(pnlPreguntaCom,BoxLayout.Y_AXIS));
            JPanel pnl0,pnl2,pnl3;
            pnlPreguntaCom.setLayout(new FlowLayout(FlowLayout.LEFT));
            pnlPreguntaCom.add(pnl0= new JPanel());

            System.out.println("paso");
            //System.out.println();
            pnl0.setLayout(new BoxLayout(pnl0, BoxLayout.Y_AXIS));
            pnl0.add(lblPregunta= new JLabel(Tpregunta));
            pnl0.add(lblTextA =new JLabel(TxAyuda));
            //auxsolu=PreguntaCom.getSolucion();
//            for(int i=0;i<auxsolu.size();i++){
//                System.out.println(auxsolu.get(i));
//            }
            pnl0.add(aux= new JComboBox());
            
            
            panelP.add(pnlPreguntaCom);
            actualizaPanel();
                    
     }
     
     if(Tipopregunta.equalsIgnoreCase("Texto")){
            //pnl1.add(pnlPreguntatexto= new JPanel());
            pnlPreguntatexto= new JPanel();
            JPanel pnlt1,pnlt2,pnlt3;
            JLabel lbltituloP,lbltexta;
            JTextField txtrespuesta;
            pnlPreguntatexto.add(pnlt1= new JPanel());
            pnlt1.setLayout(new BoxLayout(pnlt1, BoxLayout.Y_AXIS));
            //pnlPreguntatexto.add(pnlt1= new JPanel());
            pnlt1.add(lbltituloP= new JLabel(Tpregunta));
            pnlt1.add(lbltexta= new JLabel(TxAyuda));
            pnlt1.add(txtrespuesta= new JTextField(20));
            panelP.add(pnlPreguntatexto);
            actualizaPanel();
          
     }
//     
     
     
     
     
     
 }

    public void setAuxsolu(ArrayList<String> auxsolu) {
        this.auxsolu = auxsolu;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
 
    public void actualizaPanel(){
        for(int i=0;i<panelP.size();i++){
            pnl1.add(panelP.get(i));
        }
    }
 
    
}
